<include file="Public:header" />
<script type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/ToolTip.js"></script>

<div class="subnav">
  <div class="explain-col" style="position: relative;">
    <form name="searchForm" id="searchForm" method="GET" action="">
      搜索：
      <input type="text" name="keyword" id="keyword" size="30" placeholder="请输入关键词"  value="{$Think.get.keyword}" class="input-text"  style="height:20px; width:120px; color:#999" />

      <select name="source" id="source" onchange="searchForm.submit()">
        <option value="0">请选择咨询方式</option>
        <volist name=":get_source_list()" id="vo">
          <option value="{$vo.id}" {:selected($vo['id'],$_GET['source'])}>{$vo.name}</option>
        </volist>

      <input type="submit" value=" 搜索 " class="button" id="searchButton" />
    </form>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" id="myform" action="" method="post">
    <div class="table-list">
      <table width="100%" cellspacing="0">
        <thead>
          <tr>
            <th width="50" align="center">选择</th>
            <th align="center">录入时间</a></th>
            <th align="center">学员名称</th>
            <th align="center"><a href="__ACTION__/sort_level/{$sort_level|default=1}">意向级别<i class="th-sort"><img src="/Public/images/px.gif"></i></a></th>
            <th align="center"><a href="__ACTION__/sort_rank/{$sort_rank|default=1}">详细级别<i class="th-sort"><img src="/Public/images/px.gif"></i></a></th>
            <th align="center">所在地</th>
            <th align="center">课程项目</th>
            <th align="center">详细课程</th>
            <th align="center">联系电话</th>
            <th align="center">QQ</th>
            <!-- <th align="center">微信</th> -->
            <th align="center">上次跟进</th>
            <th align="center">剩余天数</th>
            <th align="center"><a href="__ACTION__/talk_time2_sort/{$talk_time2_sort|default=1}">下次跟进<i class="th-sort"><img src="/Public/images/px.gif"></i></a></th>
            <th align="center">电话内容</th>
            <th align="center">所属顾问</th>
            <th align="center">咨询方式</th>
            <th align="center">跟进次数</th>

          </tr>
        </thead>
        <tbody  id="list">
          <volist name="list" id="vo">
            <tr id="list-{$vo.id}" value="{$vo.id}" class="customer_list {$vo.class}" show="0">
              <td align="center">
                <input type="checkbox" name="idArr[]" value="{$vo.id}">
              </td>
              <td align="center">{$vo.create_time|mydate2}</td>
              <td align="center">{$vo.name}</td>
              <td align="center">{$vo.level|get_level_name}</td>
              <td align="center">{$vo.level_text}</td>
              <td align="center">{$vo.address}</td>
              <td align="center">{$vo.course|get_course_name}</td>
              <td align="center">{$vo.course_text}</td>
              <td align="center">{$vo.phone}</td>
              <td align="center">{$vo.qq}</td>
              <!-- <td align="center">{$vo.wechat}</td> -->
              <td align="center">{$vo.talk_time|mydate2}</td>
              <td align="center">{:time_diff($notTime,$vo['talk_time2'])}</td>
              <td align="center">{$vo.talk_time2|mydate2}</td>
              <td align="center" class="description" title="{$vo.content}" name="{$vo.id}">{$vo.content|cut=30}</td>
              <td align="center">{$vo.user_id|get_counselor_name}</td>
              <td align="center">{$vo.source|get_source_name}</td>
              <td align="center" class="talk_num">{$vo.talk_num}</td>

            </tr>
          </volist>
        </tbody>
      </table>
      <div class="btn">
        <div id="pages">{$page}</div>
         <input name="submit" id="checkall" type="button" class="button" value="全选/反选">
         <input name="submit" type="button" class="button" value="设为私有"  onclick="return owned(1);">
         <input name="submit" type="button" class="button" value="放入公共池"  onclick="return owned(2);">
         <eq name="Think.session.user_id" value="1">
         <input name="submit" type="button" class="button" value="清空数据"  onclick="return del();">
         </eq>
      </div>
    </div>
  </form>
</div>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(e) {


  //全反选
  $("#checkall").click(function(){
    $("input[name=idArr[]]").each(function(){
      if(this.checked == false)
        this.checked = true;
      else
          this.checked = false;
    });
  });

});

function del(status) {
    art.dialog({
        content: '确定要彻底清空所选数据吗？',
        ok: function() {
            del_data();
            return true;
        },
        cancelVal: '取消',
        cancel: true
    });
}

function owned(status) {
    art.dialog({
        content: '确定将所选择的学员设为私有的吗？',
        ok: function() {
            to_owned(status);
            return true;
        },
        cancelVal: '取消',
        cancel: true
    });
}

function to_owned(status) {
    var idArr = Array();
    var i = 0;
    var id;
    $("input[name='idArr[]']").each(function() {
        if (this.checked == true) {
            idArr[i] = $(this).val();
            i++;
        }
    });
    jQuery.get('__CONTROLLER__/owned/status/'+status, encodeURI('id=' + idArr), success, 'json');

    function success(data) {
        if (data.status == 1) {
            window.top.art.dialog({
                id: 'TNCICC',
                content: data.info,
                time: 1,
                icon: 'succeed'
            });
            setTimeout(function() {
              window.location.reload();
            }, 1000);
        } else {
            window.top.art.dialog({
                id: 'TNCICC',
                content: data.info,
                time: 1,
                icon: 'warning'
            });
        }

    }
}


function del_data() {
    var idArr = Array();
    var i = 0;
    var id;
    $("input[name='idArr[]']").each(function() {
        if (this.checked == true) {
            idArr[i] = $(this).val();
            i++;
        }
    });
    jQuery.get('__CONTROLLER__/shanchu/', encodeURI('id=' + idArr), success, 'json');

    function success(data) {
        if (data.status == 1) {
            window.top.art.dialog({
                id: 'TNCICC',
                content: data.info,
                time: 1,
                icon: 'succeed'
            });
            setTimeout(function() {
              window.location.reload();
            }, 1000);
        } else {
            window.top.art.dialog({
                id: 'TNCICC',
                content: data.info,
                time: 1,
                icon: 'warning'
            });
        }

    }
}

</script>
